/*
 * @Date: 2022-07-11 09:43:24
 * @LastEditTime: 2022-07-14 10:16:33
 */
import { request } from 'axios'

export function login ({username, password}) {
  return request({
    url: '/api/users/login',
    method: 'post',
    params: { username, password }
  })
}

export function register ({username, password}) {
  return request({
    url: '/api/users/reg',
    method: 'post',
    params: {
      username,
      password
    }
  })
}

export function getUserInfo () {
  return request({
    url: '/api/users/get_by_uid',
    method: 'get'
  })
}

export function getOneUserInfo (uid) {
  return request({
    url: '/api/users/get_by_uid',
    method: 'get',
    params: {
      uid
    }
  })
}

export function logout () {
  return request({
    url: '/api/users/login_out',
    method: 'post'
  })
}

export function changeUserInfo ({nickname, sex, birth, phone, email}) {
  return request({
    url: '/api/users/change_info',
    method: 'post',
    params: {
      nickname,
      sex,
      birth,
      phone,
      email
    }
  })
}

export function follow (uid2) {
  return request({
    url: '/api/follow/insertFollow',
    method: 'post',
    params: {
      uid2
    }
  })
}

export function findOwnFollow () {
  return request({
    url: '/api/follow/findOwnFollow',
    method: 'post'
  })
}

export function deleteFollow (uid2) {
  return request({
    url: '/api/follow/deleteFollow',
    method: 'post',
    params: {
      uid2
    }
  })
}
